package com.kelvin.paopao.adapter;

import android.content.Context;
import android.graphics.Color;
import android.support.v4.content.ContextCompat;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.kelvin.paopao.R;
import com.kelvin.paopao.api.responseBean.VipPriceModel;
import com.kelvin.paopao.api.responseBean.WalletDetailModel;

/**
 * Created by MCK on 2017/5/8.
 */

public class WalletDetailAdapter extends BaseQuickAdapter<WalletDetailModel, BaseViewHolder> {

    private Context context;

    public WalletDetailAdapter(Context context) {
        super(R.layout.recyclerview_wallet_detail_item);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, WalletDetailModel item) {
        helper.setText(R.id.tv_remark, item.getRemarks());
        if (item.getType().equals("+")) {
            helper.setTextColor(R.id.tv_price,
                    ContextCompat.getColor(context, R.color.color_yellow));
            helper.setText(R.id.tv_price, "+"+item.getMoneys());
        } else {
            helper.setTextColor(R.id.tv_price,
                    ContextCompat.getColor(context, android.R.color.holo_red_light));
            helper.setText(R.id.tv_price, "-"+item.getMoneys());
        }

        helper.setText(R.id.tv_add_time, item.getAddtime());
    }
}
